package edu.ucsur.tp.contactcenter.forms;

import java.awt.EventQueue;

import javax.swing.JInternalFrame;
import javax.swing.JLabel;

import java.awt.BorderLayout;

import javax.swing.JDesktopPane;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.ImageIcon;

import net.miginfocom.swing.MigLayout;

import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.RowSpec;

import java.awt.CardLayout;
import java.awt.FlowLayout;
import java.beans.PropertyVetoException;
import java.sql.ResultSet;
import java.util.List;

import javax.swing.JTable;
import javax.swing.JScrollPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.JComboBox;
import javax.swing.JTextPane;
import javax.swing.DefaultComboBoxModel;

import edu.ucsur.tp.beans.*;
import edu.ucsur.tp.negocio.mantenimientos.UsuarioNego;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import edu.ucsur.tp.contactcenter.utiles.*;
import javax.swing.JTextField;

public class FrmLlamadasLista extends JInternalFrame {
	
	
	private JTable tbUsuarios;
	private JDesktopPane desktop;
	private JTextField txtApellido;
	private JTextField txtTelefono;
	private JTextField textField;
	
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					FrmLlamadasLista frame = new FrmLlamadasLista();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	
	public FrmLlamadasLista(final JDesktopPane desktop) {
		this();
	    this.desktop = desktop;
	}
	
	/**
	 * Create the frame.
	 */
	public FrmLlamadasLista() {
		
		setFrameIcon(new ImageIcon(FrmLlamadasLista.class.getResource("/edu/ucsur/tp/contactcenter/images/Businessman.png")));
		setTitle("Lista de Llamadas");
		setClosable(true);
		try {
			setIcon(true);
		} catch (PropertyVetoException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setBounds(100, 100, 767, 469);
		getContentPane().setLayout(null);
		
		JButton cmdSalir = new JButton("");
		cmdSalir.setIcon(new ImageIcon(FrmLlamadasLista.class.getResource("/edu/ucsur/tp/contactcenter/images/salir.png")));
		cmdSalir.setBounds(702, 389, 39, 40);
		getContentPane().add(cmdSalir);
		
		JButton cmdNuevo = new JButton("");
		cmdNuevo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				FrmLlamadasRegistro frm = new FrmLlamadasRegistro();
				desktop.add(frm);
				GUIUtils.moveToFront(frm); 
				frm.setVisible(true);
			}
		});
		
		cmdNuevo.setIcon(new ImageIcon(FrmLlamadasLista.class.getResource("/edu/ucsur/tp/contactcenter/images/nuevo.png")));
		cmdNuevo.setBounds(664, 389, 39, 40);
		getContentPane().add(cmdNuevo);
		
		JButton cmdEliminar = new JButton("");
		cmdEliminar.setIcon(new ImageIcon(FrmLlamadasLista.class.getResource("/edu/ucsur/tp/contactcenter/images/delete.png")));
		cmdEliminar.setBounds(626, 389, 39, 40);
		getContentPane().add(cmdEliminar);
		
		JButton cmdExcel = new JButton("");
		cmdExcel.setIcon(new ImageIcon(FrmLlamadasLista.class.getResource("/edu/ucsur/tp/contactcenter/images/excel.png")));
		cmdExcel.setBounds(587, 389, 39, 40);
		getContentPane().add(cmdExcel);
		
		JButton cmdBuscar = new JButton("");
		cmdBuscar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
			}
		});
		cmdBuscar.setIcon(new ImageIcon(FrmLlamadasLista.class.getResource("/edu/ucsur/tp/contactcenter/images/search.png")));
		cmdBuscar.setBounds(702, 11, 39, 40);
		getContentPane().add(cmdBuscar);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(10, 62, 731, 321);
		getContentPane().add(scrollPane);
		
		tbUsuarios = new JTable();
		tbUsuarios.setModel(new DefaultTableModel(
			new Object[][] {
			},
			new String[] {
					"Fecha Hora","Numero","Duracion", "Cliente", "Motivo Grupo", "Motivo Deta"
			}
		));
		scrollPane.setViewportView(tbUsuarios);
		
		JLabel lblTotal = new JLabel("Total Llamadas: 0");
		lblTotal.setBounds(10, 394, 155, 14);
		getContentPane().add(lblTotal);
		
		JLabel lblNewLabel = new JLabel("Id Cliente");
		lblNewLabel.setBounds(186, 23, 46, 14);
		getContentPane().add(lblNewLabel);
		
		JLabel lblEstado = new JLabel("Motivo");
		lblEstado.setBounds(485, 23, 46, 14);
		getContentPane().add(lblEstado);
		
		JComboBox cbEstado = new JComboBox();
		cbEstado.setModel(new DefaultComboBoxModel(new String[] {"[Todos]", "Activos", "Inactivos"}));
		cbEstado.setBounds(545, 20, 132, 20);
		getContentPane().add(cbEstado);
		
		txtApellido = new JTextField();
		txtApellido.setBounds(254, 20, 56, 20);
		getContentPane().add(txtApellido);
		txtApellido.setColumns(10);
		
		JLabel lblTelefono = new JLabel("Telefono");
		lblTelefono.setBounds(320, 23, 46, 14);
		getContentPane().add(lblTelefono);
		
		txtTelefono = new JTextField();
		txtTelefono.setColumns(10);
		txtTelefono.setBounds(376, 20, 99, 20);
		getContentPane().add(txtTelefono);
		
		JLabel lblFec = new JLabel("Fecha");
		lblFec.setBounds(10, 23, 65, 14);
		getContentPane().add(lblFec);
		
		textField = new JTextField();
		textField.setColumns(10);
		textField.setBounds(77, 20, 99, 20);
		getContentPane().add(textField);

	}
	
}
